import request from '@/utils/request'

// 获取员工列表
export function getEmployees(page, pagesize) {
  return request({
    method: 'GET',
    url: '/sys/user',
    params: {
      page,
      pagesize
    }
  })
}

// 添加员工
export function addEmployee(data) {
  return request({
    method: 'POST',
    url: '/sys/user',
    data
  })
}

// 删除员工
export function delEmployee(id) {
  return request({
    method: 'DELETE',
    url: `/sys/user/${id}`
  })
}

// 获取员工基本信息
export function getEmployeeById(id) {
  return request({
    method: 'GET',
    url: `/sys/user/${id}`
  })
}

// 分配员工角色
export function assignRoles(id, roleIds) {
  return request({
    method: 'PUT',
    url: `/sys/user/assignRoles`,
    data: {
      id,
      roleIds
    }
  })
}

// 导入员工信息
export function importEmployee(data) {
  return request({
    method: 'POST',
    url: '/sys/user/batch',
    data
  })
}
